<template>
  <div class="main ub ub-ver">
    <NavBar title="客户"></NavBar>
    <div class="utabs ub ub-ac">
      <div v-for="(item,index) in ['客户查询', '新增客户', '客户统计']" :key="index" class="item ub-f1 ub ub-ver ub-ac" :class="{'on': curTab===index}" @click="curTab=index">
        <div class="txt tx-c">{{ item }}</div>
        <div class="line"></div>
      </div>
    </div>

    <div v-if="curTab == 0" class="content ub-f1" style="padding-top:20rpx">
      <div v-for="(item, index) in dataList0" :key="index" class="pItem ub ub-ac" @click.stop="toPage('/pages/shop/detail?id='+item.id)">
        <image class="pImg" :src="item.pImg" mode="aspectFill" />
        <div class="ub-f1" style="margin-left:16rpx">
          <div class="pTit">{{ item.name }}</div>
          <div class="price">
            ￥{{item.price}}
            <span>￥{{item.linePrice}}</span>
          </div>
        </div>
      </div>
    </div>
    <div v-if="curTab == 1" class="content ub-f1">
      <div class="cell plr15 ub ub-ac bbc">
        <div class="tit">制单员</div>
        <input class="ub-f1 tx-r" type="text" placeholder="制单员" />
      </div>
      <div class="cell plr15 ub ub-ac bbc">
        <div class="tit">制单时间</div>
        <input class="ub-f1 tx-r" type="text" placeholder="制单时间" />
      </div>
      <div class="cell plr15 ub ub-ac bbc">
        <div class="tit">客户名称</div>
        <input class="ub-f1 tx-r" type="text" placeholder="客户名称" />
      </div>
      <div class="cell plr15 ub ub-ac bbc">
        <div class="tit">客户代码</div>
        <input class="ub-f1 tx-r" type="text" placeholder="客户代码" />
      </div>
      <div class="cell plr15 ub ub-ac bbc">
        <div class="tit">客户简称</div>
        <input class="ub-f1 tx-r" type="text" placeholder="客户简称" />
      </div>
      <div class="cell plr15 ub ub-ac bbc">
        <div class="tit">所在地区</div>
        <input class="ub-f1 tx-r" type="text" placeholder="所在地区" />
      </div>
      <div class="cell plr15 ub ub-ac bbc">
        <div class="tit">地址</div>
        <input class="ub-f1 tx-r" type="text" placeholder="地址" />
      </div>
      <div class="cell plr15 ub ub-ac bbc">
        <div class="tit">邮箱</div>
        <input class="ub-f1 tx-r" type="text" placeholder="邮箱" />
      </div>
      <div class="cell plr15 ub ub-ac bbc">
        <div class="tit">微信</div>
        <input class="ub-f1 tx-r" type="text" placeholder="微信" />
      </div>
      <div class="cell plr15 ub ub-ac bbc">
        <div class="tit">工商登记名称</div>
        <input class="ub-f1 tx-r" type="text" placeholder="工商登记名称" />
      </div>
      <div class="cell plr15 ub ub-ac bbc">
        <div class="tit">纳税人识别号</div>
        <input class="ub-f1 tx-r" type="text" placeholder="纳税人识别号" />
      </div>
      <div class="cell plr15 ub ub-ac bbc">
        <div class="tit">开户行</div>
        <input class="ub-f1 tx-r" type="text" placeholder="开户行" />
      </div>
      <div class="cell plr15 ub ub-ac bbc">
        <div class="tit">银行账号</div>
        <input class="ub-f1 tx-r" type="text" placeholder="银行账号" />
      </div>
      <div class="cell plr15 ub ub-ac bbc">
        <div class="tit">是否开票客户</div>
        <input class="ub-f1 tx-r" type="text" placeholder="是否开票客户" />
      </div>
      <div class="cell plr15 ub ub-ac bbc">
        <div class="tit">客户类别</div>
        <input class="ub-f1 tx-r" type="text" placeholder="客户类别" />
      </div>
      <div class="cell plr15 ub ub-ac bbc">
        <div class="tit">渠道类型</div>
        <input class="ub-f1 tx-r" type="text" placeholder="渠道类型" />
      </div>
    </div>
    <div v-if="curTab == 2" class="content ub-f1" style="padding-top:200rpx">
      <button class="btn1 ub ub-ac ub-pc" style="margin-top:-50rpx" @click="scanCode()">客户排行榜</button>
      <button class="btn1 ub ub-ac ub-pc" @click="toFillIn()">客户排行榜</button>
      <button class="btn1 ub ub-ac ub-pc" @click="toFillIn()">客户群统计</button>
    </div>
    <!-- <div class="content ub-f1 ub ub-ver ub-ac ub-pc">
      <image class="nodataImg" src="../../static/null/null3.png" mode="widthFix"></image>
      <div class="nodataTxt">暂无客户</div>
    </div>-->
  </div>
</template>
<script>
import service from '@/utils/http'
import constant from '@/utils/constant'
import { errDialog, loading, toPage } from '@/utils/util'
export default {
  data() {
    return {
      curTab: 0,
      dataList0: [],
      dataList1: [],
      dataList2: [],
      toPage
    }
  },
  onReady() {
    this.getData()
  },
  methods: {
    getData() {
      service.get('/api/userGoods/list').then(res => {
        this.dataList0 = res.data.list || []
        this.dataList0.forEach(it => {
          it.pImg = it.pic.split(',')[0]
        })
      })
      service.get('/api/userCollects/list').then(res => {
        this.dataList1 = res.data.list || []
      })
    },
    toPageByParam(url, type) {
			uni.setStorageSync('actType', type)
      toPage(url)
    },
    swtichTab(index) {
      this.curTab = index
    }
  }
}
</script>
<style scoped>
.main {
  position: relative;
  width: 100%;
  height: 100%;
}
.content{
  width: 100%;
  border-radius: 16rpx 16rpx 0 0;
  background: #ffffff;
  overflow: hidden;
  position: relative;
  z-index: 1;
  padding: 0 20rpx;
  overflow: auto;
}
.pItem{width: 710rpx; padding-bottom: 20rpx;background: #fff;border-radius: 12rpx;}
.pItem:last-child{margin-bottom: 0;}
.pImg{width: 160rpx; height:160rpx;border-radius:12rpx;border:1rpx #eee solid;box-sizing: border-box;}

.pTit{font-size: 28rpx;color: #333;padding-left:10rpx;font-weight: bold;height: 120rpx;}
.price{font-size: 28rpx;color: #ff7744;font-weight: bold;padding-left:10rpx}
.count{font-size: 28rpx;color: #ccc;margin-bottom: 16rpx;padding-left:10rpx}
.price span{font-size: 24rpx;color: #ccc;margin-left:10rpx;text-decoration: line-through;}
.icon_ctrl{width: 36rpx; height: 36rpx;margin-right:6rpx;}
.num_ctrl{font-size:28rpx;color: #333;margin-right:20rpx;}
.sItem{padding-bottom: 20rpx;padding-top: 20rpx; border-bottom: 1rpx #e5e5e5 solid;}
.sItem:last-child{border-bottom: none;}
.sImg{width: 80rpx; height:80rpx;border-radius:12rpx;border:1rpx #eee solid;box-sizing: border-box;}
.sTit{font-size: 28rpx;color: #333;padding-left:10rpx;font-weight: bold;}
.entry{width: 140rpx;height: 56rpx;border:1rpx #e5e5e5 solid;border-radius: 8rpx;font-size: 24rpx;line-height: 56rpx;text-align: center;}
.cell {
  height: 100rpx;
  background: #fff;
}
.tit {
  font-size: 28rpx;
  color: #333;
  margin-right: 20rpx;
}
.cell input {
  font-size: 28rpx;
  color: #333;
}
.red {
  color: #f00;
}
.bbc {
  border-bottom: 1rpx #eee solid;
}

.btn1{
  width:600rpx;
  height:130rpx;
  line-height: 130rpx;
  font-size: 36rpx;
  color: #FFFFFF;
  background-color: #3387FF;
  margin-bottom:50rpx
}
</style>